<?php if(isset($_SESSION['user'])){?>
<?php $header=$this->action('Application\Controller\IndexController', 'headerAction',array('20','10'));
	  $baseUrl = $header->headerarray['baseUrl'];
	  $basePath = $header->headerarray['basePath'];
?>
<div class="container" id="myModal">
	<div class="well">
		<h2>Confirmation Order Form</h2><hr/>
		<div>
		<?php $print_paper_tot=0;$magazine_tot=0;$home_paper_tot=0; $grand_tot=0; if(isset($_SESSION['orders'])){
		for($i=0;$i<count($_SESSION['orders']);$i++){	
		if(isset($_SESSION['orders'][$i]['Print_Paper'])){
		if(isset($_SESSION['orders'][$i]['Print_Paper']['paper_print'])){?>
			<div class="control-group" id="a11">
				<h4>Ad type:<?echo $_SESSION['orders'][$i]['Print_Paper']['paper_print'];?></h4>
				<div class="controls">
					<? if(isset($_SESSION['orders'][$i]['Print_Paper']['paper_sur_charge'])){$print_paper_tot+=$_SESSION['orders'][$i]['Print_Paper']['paper_sur_charge'];?>
						<h5>SurCharge for PrintPaper=<span id="span1"><?echo $_SESSION['orders'][$i]['Print_Paper']['paper_sur_charge'].' Rs';?></span></h5>
					<? }if(isset($_SESSION['orders'][$i]['Print_Paper']['paper_amount'])){ $print_paper_tot+=$_SESSION['orders'][$i]['Print_Paper']['paper_amount'];?>
						<h5>Paper Population charge=<span id="span2"><?echo $_SESSION['orders'][$i]['Print_Paper']['paper_amount'].' Rs';?></span></h5>
					<?} if(isset($_SESSION['orders'][$i]['Print_Paper']['paper_price_dimension_paper'])){?>
						<h5>Image width height(1000*1200)=<span id="span3"></span></h5>
					<?} if(isset($_SESSION['orders'][$i]['Print_Paper']['paper_length_paper'])){ $print_paper_tot+=$_SESSION['orders'][$i]['Print_Paper']['paper_letter_price'];?>
						<h5>Number of letters (<? echo $_SESSION['orders'][$i]['Print_Paper']['paper_length_paper'];?>letters)=<span id="span4"><? echo $_SESSION['orders'][$i]['Print_Paper']['paper_letter_price'].' Rs';?></span></h5>
					<?} if(isset($_SESSION['orders'][$i]['Print_Paper']['paper_start_date'])){ $print_paper_tot+=$_SESSION['orders'][$i]['Print_Paper']['paper_week_st_amount'];?>
					<h5>Dates for order(<? echo $_SESSION['orders'][$i]['Print_Paper']['paper_weekdays_st'];?> Week days and <? echo $_SESSION['orders'][$i]['Print_Paper']['paper_weekends_st'];?>Week ends)=<span id="span5"><? echo $_SESSION['orders'][$i]['Print_Paper']['paper_week_st_amount'];?></span></h5>
					<?} if(isset($_SESSION['orders'][$i]['Print_Paper']['slected_days'])){?>
					<h5>Selected days(week days and weekends)=<span id="span6"></span></h5>
					<?} $grand_tot+=$print_paper_tot;?>					
					<h5>Total Amount for Print Paper:<span id="span7">&nbsp;&nbsp;<? echo $print_paper_tot.' Rs';?></span></h5> 
				</div>
				<a href="javascript:void(0);" style="margin-left:60%;" onClick="return unsetSesssionDiv('paper','<? echo $i;?>','users');">Remove the ad</a>
			</div>				
		<?php }} if(isset($_SESSION['orders'][$i]['Magazine'])){ if(isset($_SESSION['orders'][$i]['Magazine']['magazine_magazineCheck'])){ ?>
			<div class="control-group" id="a12">
				<h4>Ad type:<?echo $_SESSION['orders'][$i]['Magazine']['magazine_magazineCheck'];?></h4>
				<div class="controls">
					<? if(isset($_SESSION['orders'][$i]['Magazine']['magazine_sur_charge_magazine'])){ $magazine_tot+=$_SESSION['orders'][$i]['Magazine']['magazine_sur_charge_magazine'];?>
						<h5>SurCharge for Magazine=<span id="span1"><?echo $_SESSION['orders'][$i]['Magazine']['magazine_sur_charge_magazine'].' Rs';?></span></h5>
					<?} if(isset($_SESSION['orders'][$i]['Magazine']['magazine_price_dimension_magiz'])){ ?>
					<h5>Image width height(1000*1200)=<span id="span9"></span></h5>
					<?} if(isset($_SESSION['orders'][$i]['Magazine']['magazine_length_magazine'])){ $magazine_tot+=$_SESSION['orders'][$i]['Magazine']['magazine_letter_price'];?>
					<h5>Number of letters (<? echo $_SESSION['orders'][$i]['Magazine']['magazine_length_magazine'];?>letters)=<span id="span10"><? echo $_SESSION['orders'][$i]['Magazine']['magazine_letter_price'].' Rs';?></span></h5>
					<?} if(isset($_SESSION['orders'][$i]['Magazine']['magazine_periodtime'])){ $magazine_tot+=$_SESSION['orders'][$i]['Magazine']['magazine_period_amount'];?>
					<h5>Period of time(ex:3 months)=<span id="span11"><? echo $_SESSION['orders'][$i]['Magazine']['magazine_period_amount'].' Rs';?></span></h5>
					<?} $grand_tot+=$magazine_tot;?>
					<h5>Total Amount for magazine<span id="span12">&nbsp;&nbsp;<? echo $magazine_tot.' Rs';?></span></h5> 
				</div>
				<a href="javascript:void(0);" style="margin-left:60%;" onClick="return unsetSesssionDiv('magazine','<? echo $i;?>'.'users');">Remove the ad</a>
			</div>				
		<?php }} if(isset($_SESSION['orders'][$i]['Home_delivery'])){ if(isset($_SESSION['orders'][$i]['Home_delivery']['home_homedelevarycheck'])){?>
			<div class="control-group" id="a13">
				<h4>AdType:<?echo $_SESSION['orders'][$i]['Home_delivery']['home_homedelevarycheck'];?></h4>
				<div class="controls">
					<? if(isset($_SESSION['orders'][$i]['Home_delivery']['home_sur_charge_home'])){ $home_paper_tot+=$_SESSION['orders'][$i]['Home_delivery']['home_sur_charge_home'];?>
					<h5>SurCharge for HomeDelivary=<span id="span13"><? echo $_SESSION['orders'][$i]['Home_delivery']['home_sur_charge_home'].' Rs';?></span></h5>
					<?} if(isset($_SESSION['orders'][$i]['Home_delivery']['home_price_dimension_home'])){?>
					<h5>Image width height(1000*1200)=<span id="span14"></span></h5>
					<?} if(isset($_SESSION['orders'][$i]['Home_delivery']['home_length_home_delivery'])){ $home_paper_tot+=$_SESSION['orders'][$i]['Home_delivery']['home_letter_price'];?>
					<h5>Number of letters (<? echo $_SESSION['orders'][$i]['Home_delivery']['home_length_home_delivery'];?>letters)=<span id="span15"><? echo $_SESSION['orders'][$i]['Home_delivery']['home_letter_price'].' Rs'?></span></h5>
					<?} if(isset($_SESSION['orders'][$i]['Home_delivery']['home_radius'])){ $home_paper_tot+=$_SESSION['orders'][$i]['Home_delivery']['home_radius_amount'];?>
					<h5>Radius/Distance=<span id="span16"><? echo $_SESSION['orders'][$i]['Home_delivery']['home_radius_amount'].' Rs'?></span></h5>
					<?} $grand_tot+=$home_paper_tot;?>
					<h5>Total Amount for HomeDelivary<span id="span17">&nbsp;&nbsp;<? echo $home_paper_tot.' Rs';?></span></h5> 
				</div>
				<a href="javascript:void(0);" style="margin-left:60%;" onClick="return unsetSesssionDiv('home','<? echo $i;?>','users');">Remove the ad</a>
			</div>				
		<?}}?>
		<? if(isset($_SESSION['orders'][$i])){?>
			<div class="control-group">
				<div class="controls">
					<a href="<? echo $baseUrl;?>users/ad-posting?currentOrder=<? echo $i;?>">Edit</a>			
				</div>
			</div>		
		<?}?>
		<?}?>	
	<? if(isset($_SESSION['orders'])){?>		
		<h4>Total Amount:<span id="span19">&nbsp;&nbsp;<? echo $grand_tot.' Rs';?></span></h4>
		<input type="hidden" id="grand_total" value="<? echo $grand_tot;?>">		
		<? if($this->getUserOffers->count()>0){?>
			<div class="control-group">
				<div class="controls">
					Offers:<? foreach($this->getUserOffers as $key=>$getoffers){?>
						 <input type="radio" id="offerId" name="offerId" value="<? echo $getoffers->sent_offer_notification_id;?>" onClick="return discountOffer('<? echo $getoffers->offer_id;?>','users')">&nbsp;&nbsp;<? echo ucfirst($getoffers->offer_name);?>&nbsp;&nbsp;
					<?}?>
				</div>
				<p style=" margin-left: 60%;"><a href="<? echo $baseUrl;?>users/notifications?re-back=back">Offers link</a></p>
			</div>
			<p id="showAlert"style="display:none">Amount payable after discount:&nbsp;<span id="disCountAmount"></span></p>
		<?}?>		
		<div class="control-group">
			<div class="controls">
				<label class="radio inline">
					<input type="checkbox" id="ad_mode_offline" name="ad_mode_off_online" value="offline" onClick="return unqiueMode('offline','users')">&nbsp;&nbsp;Offline
				</label>
				<label class="radio inline">
					<input type="checkbox" id="ad_mode_online" name="ad_mode_off_online" value="online" onClick="return unqiueMode('online','users')">&nbsp;&nbsp;Online(Paypal)
				</label>	
			</div>
		</div>
		
		<div class="control-group">
				<div class="controls">
					<button type="button" style="margin-left:60%;" id="submit" class="btn" onclick="return adOrder('users')">Continue</button>
				</div>
			</div>
		</div>
	<?}?>
	<? } else{?>
		<div class="control-group">
				There are no orders.
			</div>
		</div>
	<?}?>
	</div>
</diV>
<?php }else{?>
<script>
	window.location=BASE_URL;
</script>
<?php } ?>